<template>
  <view class="new-work-order padding">
    <p style="color: #666666;margin-bottom: 30rpx;">选择工单类型</p>
    <u-row style="padding: 0 0rem">
      <u-col v-for="processDefinition in processDefinitionList" :key="processDefinition.id" style="margin-top: 15rpx;"
        :index="processDefinition.id">
        <u-button type="primary" size="medium" style="width: 100%;"
          @click="invokeNewWorkOrderHandler(processDefinition)">
          {{ processDefinition.name }}
        </u-button>
      </u-col>
    </u-row>
		<view style="width: 100%;height: 100px;"></view>
  </view>
</template>

<script>
  export default {  
  data() {
      return {
        processDefinitionList: []
      }
    },
    mounted() {
      this.getProcessDefinitionList()
    },
    methods: {
      getProcessDefinitionList() {
		  this.$request('', '/workorder/wechat/workorder/query/definitions', 'post', {}, {}, ).then(res => {
		  	this.processDefinitionList = res.data
		  })
      },
      invokeNewWorkOrderHandler(processDefinition) {
        let params = {
            p_id: processDefinition.id,
            p_key: processDefinition.key,
            p_name: processDefinition.name
          }
		uni.navigateTo({
			url:'/pages/work/NewWorkOrderHandler?params=' + JSON.stringify(params)
		})
      }
    }
  }
</script>

<style lang="scss">
  .new-work-order {
	  overflow: scroll;
	  position: fixed;
	  background-color: #fff;
	  height: 100vh;
	  width: 100%;
    .main-page-content {
      background-color: #ffffff;
    }

    .el-form-item {
      padding: .25rem .2rem;
      border-radius: .25rem;
      border: 1px solid #eeeeee;
    }

    .el-textarea {
      .el-textarea__inner {
        min-height: 6rem !important;
        margin-bottom: .5rem;
        border: none;
      }
    }

    .el-input {
      .el-input__inner {
        border: none;
      }
    }
  }
</style>
